-- api.lua

local modname = minetest.get_current_modname()

if not throwables then return end
local throwables = throwables

--
-- ---------------------------------------------
--

-- Create new throwable item
function throwables:new(name, properties)
    local self = throwables:init(name, properties)
    self:register_item(name, properties)
    self:register_entity(name, properties)
    return self
end

-- Add throwable capacity ton an existing item
function throwables:add(name, properties)
    local self = throwables:init(name, properties)
    self:register_entity(name, properties)
    self:override_on_use(name)
    return self
end


-- Add hit node callback
function throwables:on_hit_node(func)
    table.insert(self.node_hit_callbacks, func)
end

-- Add hit entity callback
function throwables:on_hit_entity(func)
    table.insert(self.entity_hit_callbacks, func)
end

-- Add hit player callback
function throwables:on_hit_player(func)
    table.insert(self.player_hit_callbacks, func)
end

--
-- ---------------------------------------------
--

